package edu.tjut.cs.web;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import edu.tjut.cs.dao.ProductDao;
import edu.tjut.cs.domain.Product;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

@RestController
public class ProductController {
	@Autowired
	private ProductDao productDao;
	
	@ApiOperation(httpMethod="POST", notes="查询满足条件的商品", value="第四个演示")
	@ApiImplicitParams({
		@ApiImplicitParam(name="key", value="商品扩展属性名", paramType="query", dataType="String"),
		@ApiImplicitParam(name="value", value="商品扩展属性值", paramType="query", dataType="String")
	})
	@PostMapping("/product")
	public List<Product> productTest1(@RequestParam String key, @RequestParam String value) {
		return productDao.findByAttribute(key, value);
	}
}
